<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/common/taglib.jsp" %>
<!DOCTYPE html>
<html lang="ko">
<head>
<title> 한국의 논매기 소리 </title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta charset="utf-8">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/>
<link href="/css/reset.css" type="text/css" rel="stylesheet" />
<link href="/css/common.css" type="text/css" rel="stylesheet" />
<link href="/css/layout.css" type="text/css" rel="stylesheet" />
<link href="/css/ui.css" type="text/css" rel="stylesheet" />
<script src="/js/jquery.min.js"></script>
<script src="/js/jquery-ui-1.10.4.custom.min.js" type="text/javascript"></script>
<!--script src="/js/gnb.min.js" type="text/javascript"></script-->
<script src="/js/gnb_ui.js" type="text/javascript"></script>
<script src="/js/left_menu.js" type="text/javascript"></script>
<script src="/js/ui.js" type="text/javascript"></script>
<script type="text/javascript">
//댑스별 메뉴 활성화
var navCurrentParam1 = ${searchVO.boardId};//1depth
var navCurrentParam2 = 0;//2depth
var navCurrentParam3 = 0;//3depth

$(document).ready(function() {
	
});

//상세폼
function viewForm(boardId, contentsInfoId){
	window.location.href="/board/contentsView.do?boardId="+boardId+"&contentsGroupId="+contentsInfoId;
}

function fncSave() {
	window.location.href="/board/contentsForm.do?boardId=${searchVO.boardId}";
}

function fncAdminSave() {
	window.location.href="/admin/contentsForm.do?boardId=${searchVO.boardId}";
}

function fncPage(page) {
	var frm = document.searchVO; 
	frm.page.value = page;
	frm.submit();
}
</script>
<c:set var="navCurrentParam1" value="${searchVO.boardId}" scope="request" />
</head>
<body>
<form:form commandName="searchVO" name="searchVO" action="/board/contentsList.do" method="get">
	<form:hidden path="boardId"/>
	<form:hidden path="searchType"/>
	<form:hidden path="searchWord"/>	
	<form:hidden path="page"/>	
</form:form>
<!-- 메뉴건너뛰기 -->
<div id="skipnavigation">
	<a href="#header">상단메뉴 바로가기</a>
	<a href="#container">컨텐츠 바로가기</a>
	<a href="#footer">하단 바로가기</a>
</div>
<div class="wrap">
	<!-- Header -->
	<jsp:include page="../common/header.jsp"></jsp:include>
	<!--// Header -->
	<!-- 컨텐츠 -->
	<div id="container" class="bg_sub">
		<div class="sub_wrap">
			<!-- 내용영역 -->
			<div class="sub_content">
				<div class="left_menu">
					<h2><img src="/img/leftMenu7.png" alt="참여서비스"/></h2>
					<!-- left 메뉴 -->
					<div id="left">
						<ul class="navmenu navmenu7">
							<li class="nvparam3"><a href="/board/contentsList.do?boardId=3">공지사항</a></li>
							<li class="nvparam4"><a href="/board/contentsList.do?boardId=4">묻고답하기</a></li>
							
						</ul>
					</div>
					<!-- //left 메뉴 -->
				</div>
				<div class="sub_area">
					<!-- 서브 네비게이션 -->
					<ul class="sub_navi">
						<li><a href="/"><img src="/img/sub_navi1.gif" alt="home"/></a></li>
						<li><a href="#">참여서비스</a></li>
						<li class="sel_navi"><a href="/board/contentsList.do?boardId=${boardInfo.boardId}">${boardInfo.boardNm}</a></li>
					</ul>
					<!-- //서브 네비게이션 -->
					<div class="sub_tit">
						<h3><img src="/img/subMenu_tit0${boardInfo.boardId}.gif" alt="${boardInfo.boardNm}"/></h3>
					</div>
					<!-- 리스트 검색창 -->
					<div class="ary_box">
						<div class="ary_left">
							<p>총 게시물 ${listResult.listCount}건 <em>[${paginationInfo.currentPageNo}/${paginationInfo.lastPageNoOnPageList} 페이지]</em></p>
						</div>
						<div class="ary_right">
							<select name="keywordType" title="선택해주세요" id="keywordType">
								<option value="01" selected="selected">제목</option>
								<option value="02">작성자</option>
								<option value="03">내용</option>
							</select>
							<input type="text" class="it " title="내용을 입력하세요" value="" name="keyword"  id="keyword" style="width:164px;"/>
							<input type="submit" value="검색" class="btn_listSch" id="searchButton"/>
						</div>
					</div>
					<!-- //리스트 검색창 -->
					<!-- 리스트 목록 -->
					<div class="tb_list">
							<table>
								<colgroup>
									<col style="width:50px;"/><col style="width:359px;"/><col style="width:120px;"/><col style="width:90px;"/><col style="width:100px;"/>
								</colgroup>
								<thead>
									<tr>
										<th>번호</th>
										<th>제목</th>
										<th>작성자</th>
										<th>등록일</th>
										<th>${boardInfo.boardTypeCd eq '03' ? '답변' : '첨부'}</th>
									</tr>
								</thead>
								<tbody>
									<c:if test="${listResult.listCount eq 0}">
									<tr>																		
										<td></td>									
										<td colspan="2" style="text-align: center;">등록된 게시물이 없습니다.</td>
										<td></td>
										<td></td>									
									</tr>
									</c:if>
									<c:forEach varStatus="counter" var="contentsInfo" items="${listResult.list}">    
									<tr>
										<td>${listResult.listCount - counter.index }</td>
										<td class="inline"><p class="ellipsis"><a href="javascript:viewForm('${contentsInfo.boardId}', '${contentsInfo.contentsGroupId}')" style="width:329px;">${contentsInfo.contentsNm}</a></p>
										</td>
										<td>${contentsInfo.writerNm}</td>
										<td><fmt:formatDate type="date"  value="${contentsInfo.writeDate}" /></td>
										<td>
											<c:choose>
												<c:when test="${boardInfo.boardTypeCd eq '03' }">
													${contentsInfo.answerCnt eq 0 ? '처리중' : '완료'}
												</c:when>
												<c:otherwise>
													<c:if test="${contentsInfo.attachFileSeq ne 0}">
													<a href="/download.do?" class="gohome"><img src="/img/ico_file.png" alt="첨부파일"/></a>
													</c:if>
												</c:otherwise>
											</c:choose>
										</td>
									</tr>
									</c:forEach>
								</tbody>
							</table>
						</div>	
						<div class="btn_area">
							<div class="t_right">
								<c:choose>
								<c:when test="${boardInfo.boardTypeCd eq '03' }">
								<a href="javascript:fncSave()" class="btn_list_view"><span>글쓰기</span></a>
								</c:when>
								<c:otherwise>
									<c:if test="${loginChk}">
									<a href="javascript:fncAdminSave()" class="btn_list_view"><span>글쓰기</span></a>
									</c:if>
								</c:otherwise>
								</c:choose>
							</div>
						</div>
					
					<!-- //리스트 목록 -->
					<!-- 페이지 네비게이션 -->
					<div class="paginate_box">
						<div class="paginate_complex paginate_complex1">
							<ui:pagination paginationInfo="${paginationInfo}" type="image"
				jsFunction="fncPage" />
			<input type="hidden" name="page" />
		
						</div>
					</div>
					<!-- //페이지 네비게이션 -->
				</div>
			</div>
			<!-- //내용영역 -->
		</div>
	</div>
	<!-- //컨텐츠 -->
	<!--// Content -->

	<jsp:include page="../common/footer.jsp"></jsp:include>
</div>
<script type="text/javascript">
//<![CDATA[
(function ($) {
	$(document).ready(function() {
		$('.search').schSelect();
		//gnb 메뉴
		navigation("gnb_wrap", "slide");
		
		$( "#keyword" ).keypress(function( event ) {
			  if ( event.which == 13 ) {
				  searchWithinResults();
			  }
		});
		
		$( "#searchButton" ).click(function( event ) {
			searchWithinResults();
		});

	});
}(jQuery));
//]]>
</script>
</body>
</html>